package com.nexus.all.controller;

import com.nexus.bean.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.nexus.all.service.IFileBatchService;
import com.nexus.web.controller.CommonController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.multipart.MultipartFile;

/**
 * 请求处理层-文件上传批次表管理类
 *
 * @author zxt
 * @version 1.0
 * @CopyRright (c): <?>
 */
@Slf4j
@RequestMapping("fileBatch")
@RestController
@Api(tags = "文件上传批次表管理接口")
public class FileBatchController extends CommonController {

    private final IFileBatchService fileBatchService;

    @Autowired
    public FileBatchController(IFileBatchService fileBatchService) {
        this.fileBatchService = fileBatchService;
    }

    @ApiOperation(value = "异步上传图片", notes = "异步上传图片")
    @PostMapping("/syncUploadImage")
    public Result syncUploadImage(@ApiParam("文件") @RequestParam("file") MultipartFile file) {
        return Result.newSuccess(fileBatchService.syncUploadImage(file, getUser().getId()));
    }

}
